<?php echo $this->render('header.phtml'); ?>
<link type="text/css" rel="stylesheet" href="/public/js_calendar/dhtmlgoodies_calendar.css" media="screen"></LINK>
<script type="text/javascript" src="/public/js_calendar/dhtmlgoodies_calendar.js"></script>
<h2><?php echo $this->escape($this->content_title);?></h2>

<form>
<table border="0" cellpadding="3">
<tr>

<td> C </td> <td> <input type="text" size="10" id="from_date" name="from_date" value="<?php echo $this->escape(trim($this->item->from_date));?>"> </td>
<td width="70"> <img id="today_trigger" src="/public/images/cal.gif" style="padding:6px;" onclick="displayCalendar(document.getElementById('from_date'),'yyyy-mm-dd',this);"> </td>


<td> По </td> <td> <input type="text" size="10" id="to_date" name="to_date" value="<?php echo $this->escape(trim($this->item->to_date));?>"> </td>
<td width="70"> <img id="today_trigger" src="/public/images/cal.gif" style="padding:6px;" onclick="displayCalendar(document.getElementById('to_date'),'yyyy-mm-dd',this);"> </td>

<td> Преподаватель </td> <td colspan="2">
<select id="teacher_id" name="teacher_id" size="1">
    <option value="">Все</option>
    <?php foreach($this->teacher_ids as $teacher) { ?> 
    <option value="<?php echo $teacher->id;?>" 
    <?php echo $this->escape(trim($this->item->teacher_id))==$teacher->id?' selected ':'';?>>
    <?php echo $teacher->first_name.' '.$teacher->last_name ;?></option>
    <?php } ?>
</select>
</td>
<td>
<a href="javascript:document.forms[0].submit();" class="bt_blue"><span class="bt_blue_lft"></span><strong>Искать</strong><span class="bt_blue_r"></span></a>
</td></tr>
</table>
</form>
<?php if($this->can_add) { ?>
<a class="bt_green" href="/lesson/add"><span class="bt_green_lft"></span><strong>Добавить</strong><span class="bt_green_r"></span></a>
<?php } ?>
<table summary="Lessons" id="rounded-corner">
    <thead>
        <tr>
            <th class="rounded-company" scope="col"></th>
            <th class="rounded" scope="col">Name</th>
            <th class="rounded" scope="col">Teacher</th>
            <th class="rounded" scope="col">Start Date</th>
            <th class="rounded" scope="col">End</th>
            <th class="rounded" scope="col">Group</th>
            <th class="rounded" scope="col">Type</th>
            <?php if($this->can_edit) { ?>
            <th class="rounded" scope="col">Attendance</th>
            <th class="rounded" scope="col">Edit</th>
            <?php } if($this->can_delete) { ?>
            <th class="rounded-q4" scope="col">Delete</th>
            <?php } ?>
        </tr>
    </thead>
    <!--<tfoot>
        <tr>
            <td class="rounded-foot-left" colspan="6"><em>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut.</em></td>
            <td class="rounded-foot-right">&nbsp;</td>

        </tr>
    </tfoot>-->
    <tbody>
<?php foreach($this->items as $obj) : ?>
        <tr>
            <td><input type="checkbox" name=""></td>
            <?php if($this->can_edit) { ?>
            <td><a href="/lesson/edit/id/<?php echo $obj->id ?>"><?php echo $this->escape($obj->name);?></a></td>
            <?php } else { ?>
            <td><?php echo $this->escape($obj->name);?></td>
            <?php } ?>
            <td><?php echo $this->escape($obj->teacher_id);?></td>
            <td><?php echo $this->escape($obj->start_date).' '.$this->escape(substr($obj->start_time,0,5));?></td>
            <td><?php echo $this->escape(substr($obj->end_time,0,5));?></td>
            <td><?php echo $this->escape($obj->studygroup_id);?></td>
            <td><?php echo $this->escape($obj->type);?></td>
            <?php if($this->can_edit) { ?>
            <td><a href="/attendance/index/lesson/<?php echo $obj->id ?>"><img border="0" title="" alt="" src="/public/images/user_edit.png"></a></td>
            <td><a href="/lesson/edit/id/<?php echo $obj->id ?>"><img border="0" title="" alt="" src="/public/images/user_edit.png"></a></td>
            <?php } if($this->can_delete) { ?>
            <td><a class="ask" href="/lesson/delete/id/<?php echo $obj->id ?>"><img border="0" title="" alt="" src="/public/images/trash.png"></a></td>
            <?php } ?>
        </tr>
<?php endforeach; ?>
               
    </tbody>
</table>
<?php if($this->can_add) { ?>
<a class="bt_green" href="/lesson/add"><span class="bt_green_lft"></span><strong>Добавить</strong><span class="bt_green_r"></span></a>
<?php } ?>
<?php echo $this->render('footer.phtml'); ?>
